/*
 * @Descripttion: 
 * @version: 
 * @Author: wtzhang
 * @Date: 2021-05-26 14:06:30
 * @LastEditors: wtzhang
 * @LastEditTime: 2021-05-26 14:33:19
 */

const fs = require('fs')

function readFileApi(filePath) {
  return new Promise(function (resolve, reject) {
    fs.readFile(filePath, 'utf8', function (err, data) {
      if (err) {
        reject(err)
      } else {
        resolve(data)
      }
    })
  })
}

// 请求
readFileApi('./data/a.txt')
  .then(function (data) {
    console.log(data);
    return readFileApi('./data/b.txt')
  })
  .then(function (data) {
    console.log(data);
    return readFileApi('./data/c.txt')
  })
  .then(function (data) {
    console.log(data);
  })